﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="search.ascx.cs" Inherits="ncp.Web.uc.search" %>
<div class="search">
        	<div class="search-con">
            	<div class="search-input bh-fl">
            	    <div class="select bh-fl">
                        	<select id="searchtype" class="indexSelect">
                                <option value="0">产品供应</option>
                                <option value="1">求购信息</option>
                                <option value="2">浓情动态</option>
                                <option value="3">科普知识</option>
                                <option value="4">招商加盟</option>
                            </select>
                            
                        </div>
                        <div class="input bh-fl">
                            <input id="txtSearch" type="text" value="" />
                        </div>
                        <div class="sub bh-fl">
                            <input id="btnSearch" onclick="search()" type="button" value="搜索产品" />
                        </div>
                        <div class="bh-clear"></div>
                </div>
                <div class="search-key bh-fl">
                    <span>热门搜索：</span>
                    <asp:Literal ID="ltHotKey" runat="server"></asp:Literal>
                </div>
                <div class="bh-clear"></div>
            </div>
        </div>
        <script type="text/javascript">
            $(function() {
                $("#searchtype").change(function() {
                    $("#btnSearch").val($("#searchtype").find("option:selected").text());
                });
                if ($("#searchtype").val()!=0) {
                    $("#btnSearch").val("搜索文章");
                }
                //回车触发搜索按钮
                $("#txtSearch").keypress(function(e) {
                    var key = window.event ? e.keyCode : e.which;
                    if (key.toString() == "13") {
                        search();
                        return false;
                    }
                });
            });
            function search() {
                var keys = $("#txtSearch").val();
                var type = $("#searchtype").val();
                if ($.trim(keys) == "") {
                    alert("搜索关键字不能为空！");
                    return;
                }
                if (type == "0") {
                    location.href = "/products/list.html?" + escape(keys);
                } else if (type == "1") {
                    location.href = "/buyingleads/index.html?" + escape(keys);
                } else if (type == "2") {
                    location.href = "/movement/index.html?" + escape(keys);
                } else if (type == "3") {
                    location.href = "/scientific/index.html?" + escape(keys);
                } else if (type == "4") {
                    location.href = "/join/index.html?" + escape(keys);
                } else {
                location.href = "/news/search.html?" + escape(keys);
                }
            }

        </script>